package common

import (
	"fmt"
	"github.com/gin-gonic/gin"
	"server/src/global"
	"server/src/model/common"
	"server/src/model/response"
	"server/src/server"
)

type Guess struct {
	errMsg string
}

// 查询bg的历史答案
func (g *Guess) QueryHistory(c *gin.Context) {
	pageInfo := &common.PageReqInfo{}
	if err := c.ShouldBindJSON(pageInfo); err != nil {
		global.GVL_LOG.Error("接受参数失败", err)
		response.FailWithMessage("查看失败，请重出入正确参数", c)
		return
	}
	fmt.Println("pageInfo__", pageInfo)
	resInfo, err := server.ServerGuess.QueryBgAnswersPages(pageInfo)
	if err != nil {
		global.GVL_LOG.Error("查询数据库出错：", err)
		response.FailWithMessage("查看失败，请稍后再试", c)
		return
	}
	response.OkWithData(resInfo, c)
}

// 查询番薯
func (g *Guess) GetBgFanShuInfo(c *gin.Context) {
	response.OkWithData(&response.GetBgFanShuInfo{
		StartAnswerId: global.BG_FT_NUMBERS_STARANSWER,
		EndAnswerId:   global.BG_FT_NUMBERS_ENDANSWER,
		AnswerNums:    global.BG_FT_NUMBERS,
	}, c)
}
